/**
 * Created by Administrator on 2017/7/26.
 */
define(function(require, exports){
	var $ = require('jquery');
	var util = require('util');
	var pubjs = require('pubjs');
	var view  = require('@base/view');
	var popwin = require('@base/dialog').base;

	// 定时下载报表
	var base = popwin.extend({
		init: function( config ) {
			config = pubjs.conf( config, {
				'title': LANG('定时报表'),
				'width': 900,
				'height': 600,
				'view_model': {
				},
				'size': 'l',
				"buttons":["ok"]
				,"buttonConfig": {
					// 确定按钮样式
					"ok": {
						"type": "button"
						, "layout": null
						, "value": LANG("确认")
						, "class": "btn btn-success"
						, "width": 100
						, "attr": {"data-action": "onOk"}
						, "events": "click"
					}
				},
				grid:{
					"param":{}
				},
			});
			this.Super('init', arguments);
		},
		afterBuild: function(){
			var self = this;
			self.Super('afterBuild',arguments);
			var el = self.getContainer('body');
			var c = this.getConfig();
			el.append($([
				'<div pub-name="grid" pub-mod="report/grid/report.timeReport"></div>'
			].join('')));
			var config = {
				'grid': {
					'param':this.getConfig('grid').param
				}
			};
			self.buildFromTemplate(config);
		},
		afterBuildTemplate:function(){
		
		},
		setParam: function (data) {
			var c = this.getConfig();
			//想要什么参数，在这里改
			c.grid.param = data;
			this.$.grid.setParam(data);
			return this;
		}
		,load: function () {
			this.$.grid.load();
			return this;
		}
		,show: function() {
			this.Super('show', arguments);
			this.$.grid.reset().load();
			return this;
		}
		,reset: function () {
			this.$selected = {};
			return this;
		},
		onOk: function () {
			this.hide();
		}
	});
	exports.base = base;
});